package com.lw.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 *  实体类。
 *
 * @author lw
 * @since 2025年05月03日 07:01:16
 */
@Schema(name = "菜单表")
@Table("tb_menu")
@Data
public class TbMenu implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Auto)
    @Schema(name = "id", description = "id")
    private Integer id;

    /**
     * 父节点id
     */
    @Schema(name = "parentId", description = "父节点id")
    private Integer parentId;

    @Schema(name = "name", description = "菜单名称")
    private String name;

    /**
     * 类型
     */
    @Schema(name = "type", description = "类型")
    private String type;

    /**
     * 路由名称
     */
    @Schema(name = "routeName", description = "路由名称")
    private String routeName;

    /**
     * 路由地址
     */
    @Schema(name = "routePath", description = "路由地址")
    private String routePath;

    /**
     * 组件路径
     */
    @Schema(name = "component", description = "组件路径")
    private String component;

    /**
     * 排序
     */
    @Schema(name = "sort", description = "排序")
    private Integer sort;

    /**
     * 菜单是否可见(1-是 0-否)
     */
    @Schema(name = "visible", description = "菜单是否可见(1-是 0-否)")
    private Integer visible;

    /**
     * 图标ICON
     */
    @Schema(name = "icon", description = "图标ICON")
    private String icon;

    /**
     * 跳转链接
     */
    @Schema(name = "redirect", description = "跳转链接")
    private String redirect;

    /**
     * 权限标识
     */
    @Schema(name = "perm", description = "权限标识")
    private String perm;

    /**
     * 路由title
     */
    @Schema(name = "title", description = "路由title")
    private String title;

    /**
     * 是否隐藏
     */
    @Schema(name = "hidden", description = "是否隐藏")
    private Integer hidden;

    /**
     * 是否开启页面缓存
     */
    @Schema(name = "keepAlive", description = "是否开启页面缓存")
    private Integer keepAlive;

    /**
     * 只有一个子路由是否始终显示
     */
    @Schema(name = "alwaysShow", description = "只有一个子路由是否始终显示 1-是 0-否")
    private Integer alwaysShow;

    /**
     * 参数
     */
    @Schema(name = "params", description = "参数")
    private String params;


    @Column(ignore = false)
    @Schema(name = "children", description = "存储子菜单")
    private List<TbMenu> children; // 存储子菜单
}